<div id="found-modal" style="top: 20%;" class="modal fade modal_small" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title"></h4>
            </div>
            <form action="<?php echo getUrl('merchant/saveFound');?>" class="form-horizontal" id="found-form" method="post">
                <div class="modal-body">

                    <div class="form-group">
                        <label class="control-label col-md-2">账户余额<span class="required">*</span></label>
                        <div class="col-md-9">
                            <div class="col-md-8 text-val merchant-balance"></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">变动<span class="required">*</span></label>
                        <div class="col-md-9" style="margin-left: 18px;">
                            <div class="radio-list">
                                <label class="radio-inline"><input name="type"  value="1" type="radio" > 增加 </label>
                                <label class="radio-inline" style="padding-left: 20px"><input name="type"  value="2" type="radio"> 减少 </label>

                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">金额<span class="required">*</span></label>
                        <div class="col-md-9">
                            <input class="form-control required number" name="amount" type="text" value="">
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <input type="hidden" name="merchant_id" value="">

                    <button type="submit" class="btn green">保存</button>
                    <button class="btn default" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> 关闭</button>

                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        var model = $('#found-modal');
        $('.add-found-btn').click(function(){
            var nickname = $('.nickname').text();
            var balance = $('.balance').text();
            var merchant_id = $(this).attr('merchant_id');
            model.find('.modal-title').html('资金调节-'+nickname);
            model.find('.merchant-balance').html(balance+'元');
            model.find('input[type="text"]').val('');
            model.find('input[name="merchant_id"]').val(merchant_id);
            model.find('.radio-inline').removeClass('hide');
            if (balance <= 0){
                model.find('input[type="radio"][value="2"]').parent().addClass('hide');
            }
            model.find('.has-error').removeClass('has-error').find('.validate_message').remove();
            model.find('.show_message_error').remove();
            model.modal();

        });

        $.e_validate.init('#found-form',{modal:model,ignore:'',successCallback:function(data){
            $('#datatable_found').dataTable().fnDraw();
            $('.balance').text(data['balance'].toFixed(2))
        }});


    });
   
</script>